export const getResponseBody = async (response: Response): Promise<any> => {
	if (response.status !== 204) {
		try {
			const contentType = response.headers.get('Content-Type');
			if (contentType) {
				const jsonTypes = ['application/json', 'application/problem+json']
				const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
				if (isJSON) {
					return await response.json();
				} else {
					return await response.text();
				}
			}
		} catch (error) {
			console.error(error);
		}
	}
	return undefined;
};
